<h1>Users</h1>
<p>Below is a list of the users.</p>

<div id="infoMessage"><?php echo $message; ?></div>

<table cellpadding=0 cellspacing=10>
    <tr>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Email</th>
        <th>Groups</th>
        <th>Status</th>
        <th>Action</th>
    </tr>
    <?php foreach ($users as $user): ?>
        <tr>
            <td><?php echo $user->first_name; ?></td>
            <td><?php echo $user->last_name; ?></td>
            <td><?php echo $user->email; ?></td>
            <td>
                <?php foreach ($user->groups as $group): ?>
                    <a href="<?php echo base_url() . "docente.php/auth/edit_group/" . $group->id; ?>"><?php echo($group->name);?> </a> 
                
                <?php endforeach ?>
            </td>
            <td><a href="<?php echo ($user->active) ? base_url() . "docente.php/auth/deactivate/" . $user->id:base_url() . "docente.php/auth/activate/" . $user->id; ?>"><?php echo ($user->active) ?"Active ":"Inactivate " ; ?></a> </td>
            
            
            <td><a href="<?php echo base_url() . "docente.php/auth/edit_user/" . $user->id; ?>">Edit </a> </td>
        </tr>
    <?php endforeach; ?>
</table>

<p><a href="<?php echo base_url() . "docente.php/auth/create_user"; ?>">Create a new user</a> | <a href="<?php echo base_url() . "docente.php/auth/create_group"; ?>">Create a new group</a></p>